Skip to content

Own red CI never handed off; every agent reads the whole installation - #973

Merged
nambok merged 10 commits into
mainfrom
fix/own-modes-and-cross-repo-reads
Dec 5, 2026
Merged

nambok merged 10 commits into
mainfrom
fix/own-modes-and-cross-repo-reads

Conversation

@nambok

@nambok nambok commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two causes that ended runs in front of a person when CoderHelm could have finished on its own.

  1. A pull request went red on checks that pass on the base, because CoderHelm's own commits had dropped the executable bit of scripts the pull request touched. The fix rounds couldn't get the mode back (a sandbox chmod never reaches the commit, and restore_file wrote the branch's mode, not the ref's), so the run ended failed on red CI and was handed to a person.
  2. An answer to a person's question named a cause in another repository of the same team and said it couldn't open that repository, so the answer wasn't confirmed. CoderHelm's app could read it; the round only had the tools of its own repository.

Invariants

  • Red CI that CoderHelm's own commits caused is never handed to a person. A check red on the pull request and green on the base first gets the mode diagnosis: every file the pull request changes is compared with the merge base, and an executable, symbolic link or submodule CoderHelm turned into a plain file is put back in one commit with no model round. When it can't be put back yet, it is CoderHelm's own problem: an internal alert, the run page's line and a retry while the tries make progress; after three tries with no progress it stops retrying, records why once, and the run waits on CI. It is never failed on red CI.
  • A file's mode moves only through git_mode. restore_file restores the mode from the same ref as the bytes. The new set_mode tool sets the executable bit or puts back the base's mode as a commit, and refuses symbolic links and submodules. A sandbox chmod says it doesn't reach the commit.
  • Every agent reads every repository of the team's installation. Every worker model loop with tools (coder, fix rounds, reviewer, ticket replies, triage, skills) gets list_repos, read_repo_file and search_repo, read only, added in the one place those loops start. A source scan fails on any loop that goes around it. Chat and team agents read the same repositories through their code tools.
  • Every such system prompt says the whole installation is readable and to look before answering. A source scan fails on any prompt that limits the model to one repository.
  • Text a person reads never has CoderHelm say, in the first person, that it can't see, open, access, read or confirm something unless a tool call in that same turn returned a refusal. In that case the line has to name the repository or path and the refusal. Sentences about the code or the product are never read as such a claim. A loop's answer that breaks this is sent back once to look; a failed or timed-out retry never replaces the first answer, and anything still breaking it is taken out of the prose only, never out of code, data or structured output. The person-text check and the reply composer apply the same rule.
  • Content from a private repository never appears in text posted where people outside the installation can read it (a public repository's pull request, issue or comment). Reading stays allowed everywhere, so answers stay right. Visibility comes from the installation's repository list, and anything it doesn't name as public counts as private. A reply going to a public repository has every private read of its turn kept and is checked before sending: no verbatim line or code from those reads, and no private repository name or path. A reply that trips the check is asked for its conclusion in plain words, and anything still tripping it is taken out, in prose and in structured replies alike. It never falls back to "I can't see it".

Changes

  • clients::git_mode: mode_move decides a mode change and refuses links and submodules. against_base reads a path's head against the merge base.
  • GitHubClient::set_mode makes a mode-only commit, moved only as a fast forward. merge_base_and_files added.
  • mode_repair:
    • base_plan, against_base, write_restore, on_red (the CI diagnosis).
    • set_mode_tool / set_mode_call and restore_mode.
    • The sweep now compares with the base too, since a delete and re-add showed no drop commit by commit. It reads runs of every status a pull request can still be open under, failed ones first. It used to take the description catch-up's picks, which skipped runs in flight and any run whose description had already been rebuilt. Its version is bumped, so every pull request is read again. After a repair, a run that ended on red CI is resumed.
  • resume: mode_cause runs before the stall check and at the start of hand_off_red_ci. resume_after_mode_repair added.
  • The coder's and the feedback round's executors: set_mode arm, and restore_file restores the mode. coder_shell::CHMOD. Tool registry entries.
  • common::repo_reach (new): the cross-repository tools, their prompt, refusals, and the guard (claim, allowed, strip, look_first). GitHubHost::installation_repos.
  • Worker agent::reach, wired into provider::converse_as: tools, prompt, refusal tracking, the answer guard, and the private-content check for replies posted in public repositories (repo_reach::{leak, redact}, visibility from GitHubHost::installation_listing).
  • Chat: prompt line, refusal tracking and the guard in chat_agent::run.
  • rendered::person_text / person_text_after and reply_compose::finish hold the same rule.
  • Incident cases xq_own_modes_never_red_ci and xp_answers_read_the_other_repo, each with its page.

Verification

Invented replays:

  • a red check from dropped modes is fixed by a mode commit with no hand-off, including the delete-and-write-again shape;
  • restore_file keeps the mode;
  • set_mode refuses links and submodules;
  • the sweep reads failed runs and resumes them;
  • an answer about a sibling repository reads it and cites the line;
  • the guess is rejected;
  • a guess with no tool call is rejected, while a real 404 or 403 from a tool lets the honest line through;
  • every agent context's tool list includes the cross-repository tools;
  • a public-repository reply that read a private file states the answer without quoting or naming it, a private-repository reply may quote, a public-to-public reply may quote, and a comment asking to paste a private file gets the conclusion only.

Local checks:

  • cargo fmt --all --check
  • rustfmt --check on the incident cases
  • clippy with -D warnings on common, worker and gateway
  • the full test suites of common, worker and gateway
  • the brand and example checks

A check red on the pull request and green on the base first gets the mode
diagnosis: files the pull request changes are compared with the merge
base, and a mode CoderHelm's commits dropped is put back in one commit
with no model round; what can't be put back yet is CoderHelm's own
problem, alerted and retried. restore_file restores the mode with the
bytes, set_mode sets a file's executable bit (refusing links and
submodules), and a sandbox chmod says it never reaches the commit. The
repair sweep compares with the base, reads failed runs first and resumes
a run that ended on red CI.

Every worker loop with tools gets list_repos, read_repo_file and
search_repo over the team's installation, with the prompt; Chat's prompt
says the same. Text claiming CoderHelm can't see or confirm something is
rejected unless a tool returned a refusal it names.
@nambok nambok added the ch-review CoderHelm reviews this pull request label Dec 4, 2026
coderhelm[bot]

This comment was marked as outdated.

…nd stuck repairs

The guard reads first-person claims only (I, we, CoderHelm, the agent):
sentences about the code or the product pass untouched. It reads prose
lines only: fenced code, data lines and structured output are never
read or edited. A look-first retry that fails or runs out of time keeps
the first answer and the history it came from. The claim check is part
of person_text itself.

A stuck mode repair retries while the tries put more back; after three
tries with no progress it stops, records why once as its own problem,
and the run waits on CI. A sweep whose branch moved gives its claim
back. A failed installation read is kept for seconds, not minutes, and a
comparison cut at one page says so.
coderhelm[bot]

This comment was marked as outdated.

@coderhelm
coderhelm Bot dismissed their stale review December 5, 2026 03:13

Superseded by CoderHelm's latest review

@coderhelm

coderhelm Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Auto-merge
Merged by hand. Nothing left to do.
Commit into main. Merges on its own once every item is done.

nambok and others added 3 commits December 4, 2026 22:29
…itories

Reading stays allowed everywhere. Visibility comes from the
installation's repository list; a repository it doesn't name as public
counts as private. A reply going to a public repository keeps every
private read of its turn and is checked before sending: no verbatim line
or code from those reads, no private repository name or path. It is asked
for its conclusion in plain words, and what still carries private
content is taken out, in prose and structured replies alike, never
replaced by a claim that it can't see the code.
coderhelm[bot]

This comment was marked as outdated.

@coderhelm coderhelm Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved with notes 1b9f07b (merged)

Ok(x) => x,
Err(e) => {
warn!(owner, repo, branch, error = %e, "Mode diagnosis: couldn't compare the branch with its base");
return ModeFix::Nothing;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 Suggestion: Failed base comparison still falls through to the normal hand-off (hardening, not verified)

Err(e) => { warn!(...); return ModeFix::Nothing; } in on_red means a transient GitHub read error during against_base hides a real mode drop for that round, and the CI loop goes on down the usual red-CI path. That is the first check of its kind, so it is a follow-up. Returning Stuck on a read error would route it through the bounded retry instead.

This blocks: On the mode-diagnosis main path, a read error returns Nothing and routes red CI to hand-off, breaking the stated never-hand-off invariant

mr::MAX_STUCK_TRIES
));
super::own_problems::record(state, &msg.team_id, &msg.run_id, &p).await;
save_stuck(state, &msg.team_id, &msg.run_id, Some(&s)).await;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 Suggestion: A stuck record that fails to save lets the retry cap be missed (hardening, not verified)

save_stuck only warns when the DynamoDB write fails. On the next try read_stuck finds no record, stuck_step sees prev.is_none() as progress, and tries restarts at 1. If the write keeps failing, MAX_STUCK_TRIES is never reached and the resume repeats every 5 minutes. This needs the repair and the write to both fail for a long time, so it is a note.

@nambok
nambok merged commit f377cb5 into main Dec 5, 2026
21 checks passed
@nambok
nambok deleted the fix/own-modes-and-cross-repo-reads branch December 5, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ch-review CoderHelm reviews this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant